package com.study7.springcache.service.impl;

import com.study7.springcache.service.BaseSupplierService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @author xuly
 * @title: BaseSupplierServiceImpl
 * @projectName spring-boot
 * @description: TODO
 * @date 2019-07-3017:15
 **/
@Service
@Slf4j
@CacheConfig(cacheNames = "models")
public class BaseSupplierServiceImpl implements BaseSupplierService {

    @Override
    @Cacheable("getById")
    public String getById(Integer id) {
        log.info("BaseSupplierServiceImpl --> getById");
        return "BaseSupplierServiceImpl";
    }

    @Override
    @CacheEvict(value = {"getById"})
    public void deleteId(Integer id) {

    }

    @Override
    @CachePut(value = {"getById"})
    public String update(Integer id) {
        log.info("BaseSupplierServiceImpl --> getById");
        return "update";
    }
}
